﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Personalplaner.App
{
	public class Util
	{
		static System.Windows.Forms.ToolStripProgressBar progressBar;

		public static void RegisterProgressBar(System.Windows.Forms.ToolStripProgressBar progress)
		{
			progressBar = progress;
		}

		public static void SetProgress(int percent)
		{
			if (progressBar != null)
			{
				if (percent > 100)
					percent = 100;
				if (percent < 0)
					percent = 0;

				progressBar.Value = percent;
			}
		}

        public static void AddProgress(int percent)
        {
            if (progressBar != null)
            {
                if (progressBar.Value + percent > 100)
                    progressBar.Value = 100;
                else
                    progressBar.Value += percent;
            }
        }
	}
}
